<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateCollegeCourseProgressTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('college_course_progress', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('courseId')->default(0)->comment('课程id');
            $table->unsignedInteger('userId')->default(0)->comment('rms userId');
            $table->unsignedInteger('resourceId')->default(0)->comment('资源表id');
            $table->unsignedInteger('finishSeconds')->default(0)->comment('已学习时间，单位秒');
            $table->unsignedInteger('totalSeconds')->default(0)->comment('素材时长，单位秒');
            $table->unsignedInteger('finishRate')->default(0)->comment('学习进度，1=1%');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '商学院 - 课程资源学习进度';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('college_course_progress');
    }
}
